package com.example.shop_2211

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.lifecycle.lifecycleScope
import com.alibaba.android.arouter.launcher.ARouter
import com.example.base.mvvm.BaseViewActivity
import com.example.shop_2211.databinding.ActivityWelcomeBinding
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch

/**
 * 欢迎页结束后，如果当前已登录，跳转到主页   如果未登录，跳转到登录页面
 */
class WelcomeActivity : BaseViewActivity<ActivityWelcomeBinding>() {
    override fun initView() {
        lifecycleScope.launch {
            for (i in 5 downTo 1){
                binding.djs.text = "$i 秒"
                delay(1000)
            }
            ARouter.getInstance().build("/app/MainActivity").navigation()
        }
    }

    override fun initData() {
    }

    override fun getLayout(): Int = R.layout.activity_welcome

}